package com.lizi.idgenerator.controller;

import com.lizi.idgenerator.config.IdConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author kingman
 * @since 2020-12-16 13:47
 */
@Controller
@RequestMapping("id")
public class IdController {

    @Autowired
    private IdConfig idConfig;

    @RequestMapping("/get/{idKey}")
    @ResponseBody
    public Long get(@PathVariable String idKey)
    {
        Long id = idConfig.getId(idKey);
        return id;
    }
}
